home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / cuj9205.zip / 1005094B < prev    next >
Text File  |  1992-06-02  |  379b  |  29 lines

  1.  
  2. Listing 7
  3.  
  4. //
  5. // test2.cpp
  6. //
  7. #include <iostream.h>
  8. #include "rat5.h"
  9.  
  10. int main()
  11.     {
  12.     int i;
  13.     rational r1 (1, 2);
  14.     rational r2 (3, 5);
  15.  
  16.     for (i = 0; i < 3; ++i)
  17.         {
  18.         cout << "r1 = " << r1 << '\n';
  19.         cout << "r2 = " << r2 << '\n';
  20.         r1 = (r1 + r2) / rational(1, 2);
  21.         r2 = r2 * rational(2, 3) - r1;
  22.         }
  23.     return 0;
  24.     }
  25.  
  26.  
  27.  
  28.  
  29.